package main;
import static com.google.common.base.Preconditions.*;

import registry.RemoteRegistryService;
import tools.CheckArgument;
import tools.Log;

public class StartRegistryService {

    /**
     * @param portRegistryMValueArgs
     */
    public static void main(String[] portRegistryMValueArgs) {
        if(portRegistryMValueArgs.length != 3) {
            Log.err("Usage: java RemoteHashTableService <port> <registry-name> <m value>");
            System.exit(0);
        }
        final int port = CheckArgument.getValidPortFromString(portRegistryMValueArgs[0]);
        final String registryName = portRegistryMValueArgs[1];
        final int mValue = Integer.parseInt(portRegistryMValueArgs[2]);
        checkArgument(mValue > 0, "M value must be greater than 0.");
        
        RemoteRegistryService.start(port, registryName, mValue);
        
    }

}
